import React, { PureComponent } from 'react';
import Link from 'umi/link'
import { List, Icon, Tag } from 'antd';
import { connect } from 'dva';
import ArticleListContent from '@/components/ArticleListContent';
import styles from './Articles.less';

@connect(({ list }) => ({
  list,
}))
class Center extends PureComponent {
  render() {
    const {
      list: { list },
    } = this.props;
    const IconText = ({ type, text }) => (
      <span>
        <Icon type={type} style={{ marginRight: 8 }} />
        {text}
      </span>
    );
    return (
      <List
        size="large"
        className={styles.articleList}
        rowKey="id"
        itemLayout="vertical"
        dataSource={list}
        renderItem={item => (
          <Link to="/job/1/detail">
            <List.Item
              key={item.id}
              // actions={[
              //   <IconText type="star-o" text={item.star} />,
              //   <IconText type="like-o" text={item.like} />,
              //   <IconText type="message" text={item.message} />,
              // ]}
            >
              <List.Item.Meta
                title={
                  <a className={styles.listItemMetaTitle} href={item.href}>
                    {item.jobTitle}
                  </a>
                }
                description={
                  <span>
                    <Tag>go语言</Tag>
                    <Tag>JavaScript</Tag>
                    <Tag>Python</Tag>
                  </span>
                }
              />
              <ArticleListContent data={item} />
            </List.Item>
          </Link>
        )}
      />
    );
  }
}

export default Center;
